//
//  ScenicTicketCell.m
//  ImGuider
//
//  Created by 王鹏宇 on 2018/1/30.
//  Copyright © 2018年 imguider. All rights reserved.
//

#import "ScenicRecommendTicketCell.h"

@implementation ScenicRecommendTicketCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    self.ticketNameLabel.textColor = kSubitleColor;
    self.appointmentLabel.textColor = kContentColor;
    
    [self.reserveBtn setTitle:MYLocalizedString(@"TICKET_BOOK_BTN", nil) forState:UIControlStateNormal];
}


- (IBAction)goReserveTicket:(UIButton *)sender {
    
    if (_delegate && [_delegate respondsToSelector:@selector(reserveTicketWith:)]) {
        
        [_delegate reserveTicketWith:self.ticketDetailModel.tid];
    }
}

- (void)configDataWith:(TicketDetailModel *)model {
    
    self.ticketDetailModel = model;
    
    self.ticketNameLabel.text = self.ticketDetailModel.subject;
    
    if (self.ticketDetailModel.price.length > 2) {
        self.ticketPriceLabel.text = [self.ticketDetailModel.priceStr substringToIndex: self.ticketDetailModel.price.length - 2];
    }else{
        self.ticketPriceLabel.text = self.ticketDetailModel.priceStr;
    }
    
    if ([[AppManager sharedManager].currencyCode isEqualToString:@"USD"]) {
        
        self.charLabel.hidden = YES;
    }else{
        self.charLabel.hidden = NO;
    }
    if (self.ticketDetailModel.advance.integerValue > 0) {
        self.appointmentLabel.text = [NSString localizedStringWithFormat:MYLocalizedString(@"TICKET_BOOK_DATE", nil),model.advance];
    }else{
        self.appointmentLabel.text = @"";
    }
   
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
